package com.bootx.controller.api;

import com.bootx.common.Result;
import com.bootx.controller.BaseController;
import com.bootx.entity.BaseEntity;
import com.bootx.entity.BetConfig;
import com.bootx.entity.FailBet;
import com.bootx.service.BetConfigService;
import com.fasterxml.jackson.annotation.JsonView;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author black
 */
@RestController
@RequestMapping("/api/failBet")
public class FailBetController extends BaseController {

    @Resource
    private BetConfigService betConfigService;

    @PostMapping("/list")
    @JsonView(BaseEntity.EditView.class)
    public Result list(){
        return Result.success(jdbcTemplate.queryForList("select id,amount from failbet order by orders asc;"));
    }

    @PostMapping("/save")
    @JsonView(BaseEntity.EditView.class)
    public Result save(FailBet failBet){
        jdbcTemplate.update("update failbet set amount=? where id=?",failBet.getAmount(),failBet.getId());
        return Result.success();
    }

}
